<?
link('ext.ModRewrite');
$mr = new ModRewrite(new FileInputStream(".htaccess"));
$subject = Request::param('target');
$replacement = Request::param('replacement');
$flags = "";
if ($mr->search_rule($subject) == -1) {
    $mr->add_rule($subject, $replacement, $flags);
    $mr->save(new FileOutputStream(".htaccess"));
    $return = new TextReturn("+");
}
else {
    $return = new TextReturn("e");
}
?>